package com.example.demo.vo

import com.example.demo.dbmodels.TPatient
import io.swagger.annotations.ApiModel
import java.math.BigDecimal
import java.time.LocalDateTime

@ApiModel(description = "病人信息")
class PatientVo {

    /**
     *  病人ID
     **/
    var id: Long ? = null
    /**
     *  病人代码
     **/
    var code: String? = null
    /**
     *  住院号
     **/
    var cure_no: String? = null
    /**
     *  病人姓名
     **/
    var name: String? = null
    /**
     *  病区号
     **/
    var district_code: String? = null
    /**
     *  科室号
     **/
    var dept_code: String? = null
    /**
     *  病房号
     **/
    var room_code: String? = null
    /**
     *  床号
     **/
    var bed_code: String? = null
    /**
     *  护理级别代码
     **/
    var nurse_level_code: String? = null
    /**
     *  费用类型(1=医保、2=自费、3=新农合)
     **/
    var outlay_type: String? = null
    /**
     *  性别（0-未知、1-男、2-女、9-未说明）
     **/
    var sex: Int?= null
    /**
     *  年龄
     **/
    var age: String? = null
    /**
     *  婚姻情况(0-未婚、1-已婚、2-丧偶、3-离异、4-未知)
     **/
    var marriage: Int?= null
    /**
     *  出生日期
     **/
    var birthday: LocalDateTime?= null
    /**
     *  行政区代码
     **/
    var pca_code: Int?= null
    /**
     *  地址
     **/
    var address: String? = null
    /**
     *  手机号码
     **/
    var mobile: String? = null
    /**
     *  学历
     **/
    var education: String? = null
    /**
     *  社会机构及职务
     **/
    var duties: String? = null
    /**
     *  证件号码
     **/
    var id_number: String? = null
    /**
     *  身高
     **/
    var height: BigDecimal?= null
    /**
     *  体重
     **/
    var weight: BigDecimal?= null
    /**
     *  区域
     **/
    var area_code: String? = null
    /**
     *  使用自定义输液规则,0=不启用,1=启用
     **/
    var custom_infusion_rule: Int?= null
    /**
     *  执行状态 0未输液  1正在输液 2输液结束
     **/
    var run_status: Int?= null
    /**
     *  开始执行时间
     **/
    var begin_time: LocalDateTime?= null
    /**
     *  结束执行时间
     **/
    var end_time: LocalDateTime?= null
    /**
     *  入院时间
     **/
    var in_time: LocalDateTime?= null
    /**
     *  出院时间
     **/
    var out_time: LocalDateTime?= null
    /**
     *  排序
     **/
    var sort: Int?= null
    /**
     *  住院状态：1入院 2转院 3出院
     **/
    var status: Int?= null
    /**
     *  民族
     **/
    var nation: String? = null
    /**
     *  备注
     **/
    var remark: String? = null
    /**
     *  入院诊断
     **/
    var diagnose: String? = null
    /**
     *  过敏类型
     **/
    var allergy: String? = null
    /**
     *  医生ID
     **/
    var doctor_code: String? = null
    /**
     *  护士ID
     **/
    var nurse_code: String? = null
    /**
     *  监护人
     **/
    var guardian: String? = null
    /**
     *  社保号
     **/
    var social_security_no: String? = null
    /**
     *  皮试信息
     **/
    var skin_test: String? = null
    /**
     *  重症监护
     **/
    var severe_care: Boolean?= null
    /**
     *  操作人
     **/
    var operator_code: String? = null
    /**
     *  操作时间
     **/
    var operator_time: LocalDateTime?= null
    /**
     *  饮食
     **/
    var diet: String? = null
    /**
     *  更新时间
     **/
    var update_time: LocalDateTime?= null
    /**
     *  更新人
     **/
    var update_by: Int?= null
    /**
     *  删除标记
     **/
    var is_del: Boolean? = null

    fun getVo(table: TPatient): PatientVo {
        table.let {
            val data = PatientVo()
            data.id = it.id
            data.address = it.address
            data.age = it.age
            data.allergy = it.allergy
            data.area_code = it.area_code
            data.bed_code = it.bed_code
            data.begin_time = it.begin_time
            data.birthday = it.birthday
            data.code = it.code
            data.cure_no = it.cure_no
            data.custom_infusion_rule = it.custom_infusion_rule
            data.dept_code = it.dept_code
            data.diagnose = it.diagnose
            data.diet = it.diet
            data.district_code = it.district_code
            return data
        }
    }

    fun getListVo(table: List<TPatient>): List<PatientVo> {
        table.let {
            val listInfoVo = mutableListOf<PatientVo>()
            table.forEach {
                val data = PatientVo()
                data.id = it.id
                data.address = it.address
                data.age = it.age
                data.allergy = it.allergy
                data.area_code = it.area_code
                data.bed_code = it.bed_code
                data.begin_time = it.begin_time
                data.birthday = it.birthday
                data.code = it.code
                data.cure_no = it.cure_no
                data.custom_infusion_rule = it.custom_infusion_rule
                data.dept_code = it.dept_code
                data.diagnose = it.diagnose
                data.diet = it.diet
                data.district_code = it.district_code
                listInfoVo.add(data)
            }
            return listInfoVo
        }
    }


//    fun getVo(queue: QueryRowSet): InfoVo {
//        queue.let {
//            val infoVo = InfoVo()
//            infoVo.name = it[TJzrInfoDao.NAME].toString()
//            infoVo.address = it[TJzrInfoDao.ADDRESS].toString()
//            infoVo.admissionId = it[TJzrInfoDao.ADMISSION_ID].toString()
//            infoVo.admissionWardTime = it[TJzrInfoDao.ADMISSION_TIME]
//            infoVo.age = it[TJzrInfoDao.AGE].toString()
//            infoVo.allergy = it[TJzrInfoDao.ALLERGY].toString()
//            infoVo.admissionWardTime = it[TJzrInfoDao.ADMISSION_WARD_TIME]
//            infoVo.arrearFlag = it[TJzrInfoDao.ARREAR_FLAG].toString()
//            infoVo.balance = it[TJzrInfoDao.BALANCE]
//            infoVo.bedNo = it[TJzrInfoDao.BED_NO].toString()
//            infoVo.birthday = it[TJzrInfoDao.BIRTHDAY]
//            infoVo.chargeType = it[TJzrInfoDao.CHARGE_TYPE]
//            infoVo.chargeTypeName = it[TJzrInfoDao.CHARGE_TYPE_NAME].toString()
//            infoVo.contactInfo = it[TJzrInfoDao.CONTACT_INFO].toString()
//            infoVo.deptCode = it[TJzrInfoDao.DEPT_CODE]
//            infoVo.deptName = it[TJzrInfoDao.DEPT_NAME].toString()
//            infoVo.diagnosis = it[TJzrInfoDao.DIAGNOSIS].toString()
//            infoVo.diet = it[TJzrInfoDao.DIET].toString()
//            infoVo.dischargeTime = it[TJzrInfoDao.DISCHARGE_TIME]
//            infoVo.doctorCode = it[TJzrInfoDao.DOCTOR_CODE].toString()
//            infoVo.doctorName = it[TJzrInfoDao.DOCTOR_NAME].toString()
//            infoVo.height = it[TJzrInfoDao.HEIGHT]
//            infoVo.id = it[TJzrInfoDao.ID]!!
//            infoVo.nation = it[TJzrInfoDao.NATION].toString()
//            infoVo.nursingClass = it[TJzrInfoDao.NURSING_CLASS].toString()
//            infoVo.patientCondition = it[TJzrInfoDao.PATIENT_CONDITION].toString()
//            infoVo.phone = it[TJzrInfoDao.PHONE].toString()
//            infoVo.prePayment = it[TJzrInfoDao.PRE_PAYMENT]
//            infoVo.professional = it[TJzrInfoDao.PROFESSIONAL].toString()
//            infoVo.selfPayment = it[TJzrInfoDao.SELF_PAYMENT]
//            infoVo.series = it[TJzrInfoDao.SERIES]
//            infoVo.sex = it[TJzrInfoDao.SEX].toString()
//            infoVo.status = it[TJzrInfoDao.STATUS].toString()
//            infoVo.totalCost = it[TJzrInfoDao.TOTAL_COST]
//            infoVo.wardCode = it[TJzrInfoDao.WARD_CODE]
//            infoVo.wardName = it[TJzrInfoDao.WARD_NAME].toString()
//            infoVo.weight = it[TJzrInfoDao.WEIGHT]
//            return infoVo
//        }
//    }

}